package com.perye.dokit.mobileController;

import com.perye.dokit.base.BaseController;
import com.perye.dokit.service.DictDetailService;
import com.perye.dokit.service.WeddingAppService;
import com.perye.dokit.utils.pageData.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @ClassName WeddingTypeAppController
 * @Description App接口类
 * @Date 2022/3/21 15:20
 * @Version 1.0
 **/
@RestController
@RequestMapping("/app/weddingAppController")
public class   WeddingAppController extends BaseController {

    @Autowired
    private WeddingAppService weddingAppService;
    @Autowired
    private DictDetailService dictDetailService;

    @RequestMapping("/queryWeddingType")
    @ResponseBody
    public PageData queryWeddingType() {
        PageData pageData = getPageData();
        PageData result = new PageData();
        try {
            List<PageData> weddingTypeList = weddingAppService.queryWeddingType(pageData);
            result.put("code", "00");
            result.put("msg", "查询成功");
            result.put("data", weddingTypeList);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }

    @RequestMapping("/queryDictList")
    @ResponseBody
    public PageData queryDictList() {
        PageData pageData = getPageData();
        PageData result = new PageData();
        try {
            String type = pageData.getString("type");
            List<PageData> typeList = dictDetailService.queryDictDetailByName(type, "list");
            result.put("code", "00");
            result.put("msg", "查询成功");
            result.put("data", typeList);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;

    }

    @RequestMapping("/queryPersonnel")
    @ResponseBody
    public PageData queryPersonnel() {
        PageData pageData = getPageData();
        PageData result = new PageData();
        try {
            List<PageData> personnelList = weddingAppService.queryPersonnel(pageData);
            result.put("code", "00");
            result.put("msg", "查询成功");
            result.put("data", personnelList);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }
}
